<div class="row">
	<div class="col-md-12">
		<ol class="breadcrumb">
			<li>
				<a href="#" onclick="toHome()">
					主页
				</a>
			</li>
			<li class="active">
				电影票记录列表
			</li>
		</ol>
	</div>
</div>
<form role="form" class="form-horizontal">
	<div class="row page-cont">
		<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 cont-top">
			<div class="panel panel-white">
				<div class="panel-heading">
					<h4 class="panel-title">
						<span class="title-text">检索电影票记录</span>
					</h4>
					<div class="panel-tools">
						<div class="dropdown">
							<a data-toggle="dropdown" class="btn btn-xs dropdown-toggle btn-transparent-grey">
								<i class="fa fa-cog"></i>
							</a>
							<ul class="dropdown-menu dropdown-light pull-right" role="menu">
								<li>
									<a class="panel-collapse collapses" href="#"><i class="fa fa-angle-up"></i> <span>折叠</span> </a>
								</li>
								<li>
									<a class="panel-expand" href="#">
										<i class="fa fa-expand"></i> <span>全屏</span>
									</a>
								</li>
							</ul>
						</div>
						<a class="btn btn-xs btn-link panel-close" href="#">
							<i class="fa fa-times"></i>
						</a>
					</div>
				</div>
				<div class="panel-body">
					<div class="form-group panel-cont">
					    <label class="col-sm-2 control-label">批次号</label>
					    <div class="col-sm-4">
					      <input type="text" class="form-control" id="batchCode" />
					    </div>
				  	</div>
				  	<div class="form-group">
				  		<div class="col-sm-5 col-sm-offset-5">
				  			<button type="button" class="btn btn-primary query-btn">查询</button>
				  			<button type="reset" class="btn">重置</button>
				  		</div>
				  	</div>
				</div>
			</div>
		</div>
		<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 cont-bottom">
			<div class="panel panel-white">
				<div class="panel-heading">
					<h4 class="panel-title">
						<span class="title-text">电影票记录列表</span>
					</h4>
					<div class="panel-tools">
						<div class="dropdown">
							<a data-toggle="dropdown" class="btn btn-xs dropdown-toggle btn-transparent-grey">
								<i class="fa fa-cog"></i>
							</a>
							<ul class="dropdown-menu dropdown-light pull-right" role="menu">
								<li>
									<a class="panel-collapse collapses" href="#"><i class="fa fa-angle-up"></i> <span>折叠</span> </a>
								</li>
								<li>
									<a class="panel-expand" href="#">
										<i class="fa fa-expand"></i> <span>全屏</span>
									</a>
								</li>
							</ul>
						</div>
						<a class="btn btn-xs btn-link panel-close" href="#">
							<i class="fa fa-times"></i>
						</a>
					</div>
				</div>
				<div class="panel-body table-body">
					<table class="table table-bordered table-hover">
						<thead>
							<tr>
								<th class="hidden-xs">批次号</th>
								<th class="hidden-xs">后台用户信息</th>
								<th class="hidden-xs">短信通知手机号</th>
								<th class="hidden-xs">创建时间</th>
								<th class="hidden-xs">操作</th>
							</tr>
						</thead>
						<tbody>

						</tbody>
					</table>
					<div class="M-box3 page-style"></div>
				</div>
			</div>
		</div>
	</div>
</form>
<script>
	/*********************************变量***********************************/
	var pageNo = 1;    // 第几页
	var pageSize = 10; // 每页几条
	var totalPage;     // 总页数
	var totalData;     // 总条数
	var username = GetQueryString("username");    // 用户姓名
	var token = MXCookie.get("token",token);      // 登陆token   
	/*********************************事件***********************************/

	// 查询
	$(".query-btn").click(function(){
		// getList();
	});



	/*********************************函数***********************************/
	// 获取列表
	function getList() {
		$("tbody").html("");
		$.ajax({
			url: localStorage.grobalUrl + "/schedule/orderTicketList",
			type: "post",
			async:false,
			data:{
				username: username,
				token: token,  
				pageNo: pageNo,   
				pageSize: pageSize
			},
			success: function(data){
				console.log(data);
				var str =  '<tr align="center">'+
								'<td class="batch-number"></td>'+
								'<td class="user-msg"></td>'+
								'<td class="user-mobile"></td>'+
								'<td class="create-time"></td>'+
								'<td>'+
									'<button type="button" class="btn btn-dark-yellow check-btn">查看&nbsp;<i class="fa fa-eye"></i></button>'+
								'</td>'+
							'</tr>';
				if(data.errCode == "00005"){
					tips("请重新登陆");
					setTimeout(function(){
						window.location.href = "login_login.html";
					},500);
				}else if (data.page){
				  	var dataVal = data.page.list;
			        totalPage = data.page.totalPage;
			        totalData = data.page.totalRow;
			        for(var i = 0; i < dataVal.length; i ++){
			            var listVal = dataVal[i];
			            $("tbody").append(str);
			            $(".batch-number").eq(i).text(listVal.batchno).attr("data-id",listVal.id);
			            $(".user-msg").eq(i).text(listVal.uid);
			            $(".user-mobile").eq(i).text(listVal.mobile);
			            $(".create-time").eq(i).text(listVal.create_time);
			        }
			  
			        // 查看
					$(".check-btn").click(function(){
				        var index = $(".check-btn").index(this);
				        batchNo = $(".batch-number").eq(index).text();
				        $(".pageAdd").attr("data-id",batchNo);
				        pageUrl = "view/movieTicketRecord/ticket-view.html";
				        url = pageUrl;
				        getPage(url); 
				    });				        
				}else{
				  $("tbody").append("<tr><td align='center' colspan='5'>暂无数据</td></tr>");
				}
					
			},
			error: function(error){
				console.log(error);
			}
		});	
	}
	getList();

	// 分页
	pageSetGet();

	
</script>
